import sympy as sp

def show_fun_df_integral(f,x,range_list):
    df = sp.diff(f,x)
    integral = sp.integrate(f,x)
    print('函数 f(x) = ',f)
    print('导数 df(x) = ',df)
    print('不定积分 integral = ',integral)
    for item in range_list:
        a,b = item
        print('定积分 definite_integral = ',sp.integrate(f,(x,a,b)))


if __name__ == '__main__':
    x = sp.symbols('x')

    # 公式1
    f = x**2
    show_fun_df_integral(f,x,[(0,1),(0,2),(0,5)])

    # 公式2
    f = 2*x
    show_fun_df_integral(f,x,[(0,1),(0,2),(0,5)])